package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BbgMember;
import com.ruoyi.system.service.IBbgMemberService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会员信息Controller
 * 
 * @author ruoyi
 * @date 2024-05-21
 */
@RestController
@RequestMapping("/system/member")
public class BbgMemberController extends BaseController
{
    @Autowired
    private IBbgMemberService bbgMemberService;

    /**
     * 查询会员信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:member:list')")
    @Log(title = "查看会员信息", businessType = BusinessType.OTHER)
    @GetMapping("/list")
    public TableDataInfo list(BbgMember bbgMember)
    {
        startPage();
        List<BbgMember> list = bbgMemberService.selectBbgMemberList(bbgMember);
        return getDataTable(list);
    }

    /**
     * 导出会员信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:member:export')")
    @Log(title = "会员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BbgMember bbgMember)
    {
        List<BbgMember> list = bbgMemberService.selectBbgMemberList(bbgMember);
        ExcelUtil<BbgMember> util = new ExcelUtil<BbgMember>(BbgMember.class);
        util.exportExcel(response, list, "会员信息数据");
    }

    /**
     * 获取会员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:member:query')")
    @GetMapping(value = "/{memberId}")
    public AjaxResult getInfo(@PathVariable("memberId") Long memberId)
    {
        return success(bbgMemberService.selectBbgMemberByMemberId(memberId));
    }

    /**
     * 新增会员信息

    @PreAuthorize("@ss.hasPermi('system:member:add')")
    @Log(title = "会员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BbgMember bbgMember)
    {
        return toAjax(bbgMemberService.insertBbgMember(bbgMember));
    }*/

    /**
     * 修改会员信息

    @PreAuthorize("@ss.hasPermi('system:member:edit')")
    @Log(title = "会员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BbgMember bbgMember)
    {
        return toAjax(bbgMemberService.updateBbgMember(bbgMember));
    }*/

    /**
     * 删除会员信息

    @PreAuthorize("@ss.hasPermi('system:member:remove')")
    @Log(title = "会员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{memberIds}")
    public AjaxResult remove(@PathVariable Long[] memberIds)
    {
        return toAjax(bbgMemberService.deleteBbgMemberByMemberIds(memberIds));
    }*/
}
